"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCache = exports.setCache = void 0;
/**
 * 封装一个在sql调用的时候用的简单缓存方法
 */
let statementCache = new Map();
let paramsCache = new Map();
let cache = { "statementCaches": statementCache, "paramsCaches": paramsCache };
function setCache(mapperName, sqlName, cacheSqlValue, cacheParamsValue) {
    let newName = `${mapperName}_${sqlName}`;
    if (cache.statementCaches.has(newName))
        return;
    cache.statementCaches.set(newName, cacheSqlValue);
    cache.paramsCaches.set(newName, cacheParamsValue);
}
exports.setCache = setCache;
function getCache(mapperName, sqlName) {
    let newName = `${mapperName}_${sqlName}`;
    if (!cache.statementCaches.has(newName))
        return null;
    let sql = cache.statementCaches.get(newName);
    sql = sql == undefined ? "" : sql;
    let params = cache.paramsCaches.get(newName);
    params = params == undefined ? [] : params;
    return { sql, params };
}
exports.getCache = getCache;
